<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover"
    />
    <meta name="format-detection" content="telephone=no" />
    <title></title>
    <style>
      html,
      body {
        padding: 0;
        margin: 0;
        height: 100%;
      }

      #Main {
        height: 100%;
        overflow: hidden;
      }

      #Main iframe {
        width: 100%;
        height: 100%;
      }
    </style>
  </head>

  <body>
    <div id="Main"></div>

    <script>
      //获取地址栏参数 duge true-查#后面参数  false/空-查?后面参数
      function localName(name, duge) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        if (duge) {
          var r = location.hash.substr(1).match(reg);
        } else {
          var r = location.search.substr(1).match(reg);
        }
        if (r != null) return decodeURI(r[2]);
        return null;
      }
      const fileUrl = localName("pdf");
      let title = "单位参保证明2022-10-26+15:12:26";

      document.querySelector("title").innerHTML = fileUrl
        ? fileUrl.replaceAll("$", ":")
        : title;
      //初始化
      var file_ = fileUrl
        ? `https://lin147.gitee.io/uem/pdf/web/${fileUrl}.pdf?str=123`
        : "https://lin147.gitee.io/uem/pdf/web/公司最新社保证明.pdf?str=123";
      document.getElementById("Main").innerHTML =
        '<iframe src="./viewer.html?file=' +
        file_ +
        '" frameborder="no"></iframe>'; //
    </script>
  </body>
</html>
